import ajax from '../untils/request.js'

// 登录请求
export const login = (mobile, code) => {
  return ajax({
    url: '/app/v1_0/authorizations',
    method: 'post',
    data: {
      mobile,
      code
    }
  })
}

// 获取用户个人资料信息
export const getTokeninfo = () => {
  return ajax({
    url: '/app/v1_0/user/profile',
    method: 'GET'
  })
}

// 获取用户个人信息
export const getUserInfo = () => {
  return ajax({
    url: '/app/v1_0/user',
    method: 'GET'
  })
}

// 编辑用户资料
export const updateUserInfo = (data) => {
  return ajax({
    url: '/app/v1_0/user/profile',
    method: 'PATCH',
    data
  })
}

// 编辑用户头像
export const updateUserPhoto = (fd) => {
  return ajax({
    url: '/app/v1_0/user/photo',
    method: 'PATCH',
    data: fd
  })
}
